namespace BM.Tools.WebControls.MForm.Controls.Helper
{
    using System.Web.UI;
    using System.Web.UI.WebControls;

    /// <summary>
    /// A simple control that displays item data on mouse over and hides this data on mouse out
    /// </summary>
    public class BubbleTooltip : WebControl
    {
        /// <summary>
        /// Gets or sets CssClass.
        /// </summary>
        /// <value>
        /// The css class.
        /// </value>
        public override string CssClass
        {
            get
            {
                return "MForm-Bubble";
            }

            set
            {
                base.CssClass = value;
            }
        }

        /// <summary>
        /// adds the onmouseover and onmouseout attributes
        /// </summary>
        /// <param name="writer">
        /// The writer.
        /// </param>
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass);
            writer.AddAttribute("onmouseover", "BM.BubbleTooltipAddition.show(this);");
            writer.AddAttribute("onmouseout", "BM.BubbleTooltipAddition.hide(this);");
        }

        /// <summary>
        /// renders the inner span
        /// </summary>
        /// <param name="writer">
        /// The writer.
        /// </param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.Write("<span></span>");
        }
    }
}